function Player(){
	this.image = new Image();
	this.image.src = "../resources/ball.png";

	//size of single frame
	this.width = 100;
	this.height = 100;

	//position
	this.x = 0;
	this.y = 0;

	this.speed = 0;//positive in direction up

	this.setPosition = function(x, y){
		this.x = x;
		this.y = y;
	};
	
	this.jump = function(){
		this.setPosition(this.x, this.y-this.speed);
		this.speed--;//gravity;)
	};
	
	this.move = function(direction, min, max){
		if(direction == 'left'){
			if (this.x > min)
				this.setPosition(this.x - 5, this.y);
		} else {
			if (this.x + this.width < max) 
				this.setPosition(this.x + 5, this.y);
		}
	};
	this.draw = function(ctx){
		try {
			ctx.drawImage(this.image, 0, 0, this.width, this.height, this.x, this.y, this.width, this.height);
			//drawImage(Image Object, source X, source Y, source Width, source Height, destination X (X position), destination Y (Y position), Destination width, Destination height)
		} catch (e) {
			//sometimes, if character's image is too big and will not load until the drawing of the first frame, Javascript will throws error and stop executing everything. To avoid this we have to catch an error and retry painting in another frame. It is invisible for the user with 50 frames per second.
		}
	};

}